<!--
 * @Descripttion: 
 * @Author: liuYaoYu
 * @Date: 2021-12-16 16:40:22
 * @LastEditors: liuYaoYu
 * @LastEditTime: 2021-12-16 16:53:31
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var regrex = /^[a-zA-Z0-9-_]{6,16}$/;//六到十六次
        console.log(regrex.test("reaedrt"));
        console.log(regrex.test("rea_drt"));
        console.log(regrex.test("rea-drt"));
        console.log(regrex.test("rea!drt"));
        
    </script>
</body>
</html>